﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="../style.css">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>

<form action="spieltage_freigeben_v2.php" method="post">


<?php
	

	include("../inc/joomlaInt_admin.php");
	include("../inc/inc_configuration.php");

if ($jUser==0)
{
	echo "Bitte zuerst einloggen!";
}
else
{	
	
	$q="SELECT gid FROM $tbl_users WHERE id=$jUser";
					$qe=mysql_query($q);
					$qeo=mysql_fetch_object($qe);
					
					$gid=$qeo->gid;
					
					if ($gid!=$admingroup)
					{
						echo "Du bist kein Admin!";
						break;
					}
					
	$liga=$_SESSION["liga"];
	$gruppe=$_GET["gruppe"];
	$ref=$_GET["ref"];
	
	
	if ($ref!=1)
	{
		$lq = "SELECT t.id FROM $tbl_teams t, $tbl_lt lt WHERE lt.leagueId=$liga AND lt.teamId=t.id";
	}
	else
	{
		$lq = "SELECT * FROM $tbl_gt WHERE groupId=$gruppe";
	}

	$lqe = mysql_query($lq);
	$count = mySQL_num_rows($lqe);

	if ($count % 2 ==0)
		{
			$matchdays = ($count-1)*2;
		}
		else
		{
			$matchdays = $count*2;
		}
	
	
	echo 'Letzten freizugebenen Spieltag auswählen:<br><select name="matchday" Size="1">';	
	
	$i=1;
	while($i<$matchdays+1)
	{
		echo '<Option Value="',$i,'">',$i,'</option>';
		$i++;
	}
	echo"</select>";
	
	echo '	<input type="text" name="ref" value="',$ref,'" hidden>
			<input type="text" name="gruppe" value="',$gruppe,'" hidden>
			<br><br>
			<input type="submit" value="Freigeben" class="button freigeben">
			</form>';
}

?>


</body>
</html>